//用户管理模块
import request from "@/utlis/request";
import type {
  IUser,
  IUserResponseData,
  IPage,
  IDeleteResponseData,
  ISave,
} from "@/api/acl/type";

//枚举地址
enum API {
  ALLUSER_URL = "/user/findPage", //列表查询
  SAVEUSER_URL = "/user/save", //新增或编辑
  DELETEUSER_URL = "/user/delete", //删除
  FINDPERMISSIONS_URL = "/user/findPermissions", //用户权限
}

export const reqUserList = (data: IPage) => {
  return request.post<any, IUserResponseData>(API.ALLUSER_URL, data);
};

export const reqAddOrUpdateUser = (data: IUser) => {
  return request.post<any, ISave>(API.SAVEUSER_URL, data);
};

export const reqDeleteUser = (data: any) => {
  return request.post<any, IDeleteResponseData>(API.DELETEUSER_URL, data);
};

export const reqFindpermissions = async (name: string) => {
  return request.get<any, any>(API.FINDPERMISSIONS_URL + "?name=" + name);
};
